
<div class="modal-header">
    <h1>{{title}}</h1>
</div>
<div class="modal-body">
    <div class="row">
        <div class="col-sm-11 col-sm-offset-1">
            <form class="form-horizontal" ng-submit="close(login,password)">
                <!-- needed for ng-submit to work -->
                <input type="submit" id="submit" style="display:none"/>

                <div ng-if="warning">
                    <p style="color:red;">
                        {{warning}}
                    </p>
                </div>

                <!-- PROVIDER -->
                <div class="form-group">
                    <label for="provider" class="col-sm-2 control-label">Provider</label>

                    <div class="col-sm-8">
                        <select id="provider" class="form-control" style="width:auto;display:inline-block;"
                                ng-options="provider as provider for provider in providers"
                                ng-model="user.provider"
                                ng-disabled="edit"></select>
                    </div>
                </div>

                <!-- LOGIN -->
                <div class="form-group">
                    <label for="login" class="col-sm-2 control-label">Login</label>

                    <div class="col-sm-8">
                        <input id="login" type="text" ng-model="user.login" class="form-control" placeholder="Login" ng-readonly="edit">
                    </div>
                </div>

                <!-- NAME -->
                <div class="form-group">
                    <label for="name" class="col-sm-2 control-label">Name</label>

                    <div class="col-sm-8">
                        <input id="name" type="text" ng-model="user.name" class="form-control" placeholder="Name">
                    </div>
                </div>

                <!-- EMAIL -->
                <div class="form-group">
                    <label for="email" class="col-sm-2 control-label">Email</label>

                    <div class="col-sm-8">
                        <input id="email" type="text" ng-model="user.email" class="form-control" placeholder="Email">
                    </div>
                </div>

                <!-- PASSWORD -->
                <div class="form-group">
                    <i class="fa fa-refresh" ng-click="generatePassword()" ng-if="user.provider == 'local'"></i>
                    <label for="password" class="col-sm-2 control-label">Password</label>

                    <div class="col-sm-8">
                        <input id="password" type="text" ng-model="user.password" ng-readonly="user.provider != 'local'" class="form-control" placeholder="Password">
                    </div>
                </div>

                <!-- MAX FILE SIZE -->
                <div class="form-group">
                    <p>0 for server default, -1 for unlimited</p>
                    <label for="maxFileSize" class="col-sm-2 control-label">Max File Size</label>

                    <div class="col-sm-8">
                        <input id="maxFileSize" type="text" ng-model="maxFileSize" class="form-control" placeholder="Max File Size" ng-readonly="!auth_user.admin">
                    </div>
                </div>

                <!-- MAX USER SIZE -->
                <div class="form-group">
                    <p>0 for server default, -1 for unlimited</p>
                    <label for="maxUserSize" class="col-sm-2 control-label">Max User Size</label>

                    <div class="col-sm-8">
                        <input id="maxUserSize" type="text" ng-model="maxUserSize" class="form-control" placeholder="Max User Size" ng-readonly="!auth_user.admin">
                    </div>
                </div>

                <!-- MAX TTL -->
                <div class="form-group">
                    <p>0 for server default</p>
                    <label for="maxTTL" class="col-sm-2 control-label">Max TTL</label>

                    <div class="col-sm-8">
                        <div id="maxTTL" style="display:inline-block;">
                            <input class="form-control" style="width:60px;display:inline-block;" type="number"
                                   ng-model="ttlValue" ng-show="ttlUnit != 'unlimited'"
                                   ng-disabled="!auth_user.admin">
                            <select class="form-control" style="width:auto;display:inline-block;"
                                    ng-options="unit as unit for unit in ttlUnits"
                                    ng-model="ttlUnit"
                                    ng-disabled="!auth_user.admin"></select>
                        </div>
                    </div>
                </div>

                <!-- ADMIN -->
                <div class="form-group">
                    <label for="admin" class="col-sm-2 control-label">Admin</label>

                    <div class="col-sm-8">
                        <div id="admin" style="display:inline-block;">
                            <input type="checkbox" class="form-control" ng-model="user.admin" ng-disabled="!auth_user.admin">
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<div class="modal-footer">
    <button ng-click="$dismiss('cancel')" class="btn btn-danger">Cancel</button>
    <button ng-click="close(user)" class="btn btn-primary">ok</button>
</div>